<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <ul>
        <li><router-link to="/home">Home</router-link></li>
        <li><router-link to="/settings/emails">emails</router-link></li>
        <li><router-link to="/settings/profile">profile</router-link></li>
      </ul>
      <router-view></router-view>
    </div>
    <script src="vue.js"></script>
    <script src="vue-router.js"></script>
    <script>
      const Home = {
        template: `<div>Home</div>`,
      };
      const routes = [
        //当访问/的时候，会重定向到/home路径里
        //此跳转用户是可以感知到的
        /**{path: "/", redirect(to){
          console.log(to)
          return '/home';
        }
        redirect:'/home',redirect:{name:'home'}},**/
        {name:'home',path: "/home",alias:'/', component: Home }
      ];
      var router = new VueRouter({
        routes,
      });
      var vm = new Vue({
        el: "#app",
        router,
      });
    </script>
  </body>
</html>
